{template '_header'}
<link rel="stylesheet" href="../addons/ewei_shopv2/plugin/groups/template/mobile/default/css/style.css" />
<style type="text/css">
	i{font-style: normal;}
	.order_goods_img img {border: 1px solid rgb(215, 215, 215); border-image: none; width: 60px; height: 60px; display: block;}
	.order_goods_price i {font-size: 9px;}
	#cover{display:none;position:absolute;left:0;top:0;z-index:18888;background-color:#000000;opacity:0.7;}
	#guide{display:none;position:absolute;right:18px;top:5px;z-index:19999;}
	#guide img{width:260px;height:180px;}

	.pp_tips {padding: 10px 5px; text-align: center; font-size: 14px;}
	.pp_tips b {margin: 0px 5px; color: rgb(223, 33, 39); font-size: 18px;}

	#shareit img {max-width: 100%;}
	.mod_footer_lk a {height: 12px; color: rgb(153, 153, 153); line-height: 12px; overflow: hidden; padding-right: 8px; margin-right: 8px; border-right-color: rgb(215, 215, 215); border-right-width: 1px;
		border-right-style: solid;}
	.mod_footer_lk a:last-child {padding-right: 0px; margin-right: 0px; border-right-color: currentColor; border-right-width: 0px; border-right-style: none;}
	.address_new button {border-radius: 2px; border: 0px currentColor; border-image: none; width: 100%; height: 40px; color: rgb(255, 255, 255); line-height: 40px; font-size: 16px; margin-bottom: 10px; display: block; background-color: rgb(56, 132, 255);
	}
	.fui-tab.detail-tab {margin: 0;margin-top: 0.5rem;}

	.fui-tab.detail-tab:before {content: '';position: absolute;left: 0;top: 0;width: 200%;border-top: 1px solid #d0d0d0;display: block;
		-webkit-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scale(.5, .5);transform: scale(.5, .5);}
	.fui-tab.detail-tab:after {-webkit-transform-origin: 0 0;-ms-transform-origin: 0 0;transform-origin: 0 0;-webkit-transform: scaleY(0.5);-ms-transform: scaleY(0.5);
		transform: scaleY(0.5);}
	.detail-block > div{display: none;background: #fff;padding:0.2rem;border-bottom:1px solid #f0f0f0;}
</style>
<div class='fui-page order-list-page'>
	<div class="fui-header">
		<div class="fui-header-left">
			<a class="back" href="{php echo mobileUrl('order')}"></a>
		</div>
		<div class="title">团详情</div>
		<div class="fui-header-right" onclick="location.href='{php echo mobileUrl('groups/team')}'">
			<span class="icon icon-group" style="font-size:1.1rem;"></span>
		</div>
	</div>
	<div class='fui-content' style="padding-bottom:0;top:2.2rem;">
		<div class="lynn_team_detail_head">
			<div class="fui-swipe lynn_swipe" data-speed="5000" data-gap="5">
				<div class="fui-swipe-wrapper">
					{loop $goods['thumb_url'] $thumb}
					<div class="fui-swipe-item"><img src="{php echo tomedia($thumb)}" alt="{$goods['title']}" onerror="this.src='../addons/ewei_shopv2/static/images/nopic100.jpg'"></div>
					{/loop}
				</div>
				<div class="fui-swipe-page">
					{loop $goods['thumb_url'] $thumb}
					<div class="fui-swipe-bullet"></div>
					{/loop}
				</div>
			</div>
			{if $order['success']==1}
			<img class="team_img" src="../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/success.png" alt="组团成功">
			{else if $lasttime2 > 0 && $order['success']==0}
			<img class="team_img" src="../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/frightin.png" alt="等待成团">
			{else if $order['success']==-1}
			<img class="team_img" src="../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/fail.png" alt="团购失败">
			{/if}
			<input type="hidden" name="title" value="{$goods['title']}" id="gname">
			<h2 class="lynn_team_detail_title">{$goods['title']}</h2>
			<p class="lynn_team_detail_goods_info">
				拼团价：¥<strong>{$goods['groupsprice']}</strong>/{if $goods['units']}{$goods['goodsnum']}{$goods['units']}{else}1件{/if}<del>{$goods['price']}</del>
			</p>
		</div>
		<div class="pp">
			{if $lasttime2 > 0 && $n > 0 }
			<div class="fui-cell">
				<div class="fui-cell-text">
					<div class='fui-labeltext fui-labeltext-danger fui-timer'
						 data-now="{php echo date('Y-m-d H:i:s')}"
						 data-start="{php echo date('Y-m-d H:i:s', $tuan_first_order['starttime'])}"
						 data-end="{php echo date('Y-m-d H:i:s', $tuan_first_order['endtime'])}"
						 data-end-label='拼团剩余' data-start-label='距离开始还有'>
						<div class='label'></div>
						<div class='text'>
							<span class="day number text-danger" >-</span><span class="time">天</span>
							<span class="hour number text-danger">-</span><span class="time">小时</span>
							<span class="minute number text-danger">-</span><span class="time">分</span>
							<span class="second number text-danger">-</span><span class="time">秒</span>
						</div>
					</div>
					，还差<b>{$n}</b>人
				</div>
			</div>
			{/if}
			<div id="" style="clear: both;"></div>
			<div class="pp_users" id="pp_users">
				{loop $orders $order}
					{if $order['openid'] == $tuan_first_order['openid']}
					<a href="javascript:void(0);" class="pp_users_item pp_users_normal"><img src="{$order['avatar']}" onerror="this.src='../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/avatar.png'"></a>
					{else}
					<a href="javascript:void(0);" class="pp_users_item pp_users_normal"><img src="{$order['avatar']}" onerror="this.src='../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/avatar.png'"></a>
					{/if}
				{/loop}

				{loop $arr $ar}
				<a href="javascript:void(0);" class="pp_users_item"><img src="../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/avatar.png"></a>
				{/loop}
			</div>
			<div class="pp_tips" id="flag_0_a" >
				<div class="groups_info">
					{if $lasttime2 >0 && $n > 0 }
					快邀请好友一起来拼团吧！
					{else}
					团购已结束
					{/if}
				</div>
			</div>
		</div>
		<div class="fui-tab fui-tab-danger detail-tab" id="detailTab" style="position: initial;">
			<a data-tab="team" class="active">拼团详情</a>
			<a data-tab="basic">商品详情</a>
		</div>
		<div class="detail-block">
			<div class="block block-team tab-team" id="team" style="display: block;">
				<dl class="lynn_team_list">
					<dt class="lynn_team_list_top" style="display: none;">
						<b></b>
						<p>查看全部团详情 <i class="iconfont icon lynn_icon">&#xe764;</i></p>
					</dt>
					{loop $orders $order}
					{if $order['openid'] == $tuan_first_order['openid']}
					<dd class="lynn_team_list_dd row">
						<img src="{$order['avatar']}" alt="{$order['nickname']}" onerror="this.src='../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/avatar.png'">
						<span class="fl">{$order['nickname']}</span>
						<span class="fr">{php echo date('Y-m-d H:i:s', $order['paytime'])} 开团</span>
					</dd>
					{else}
					<dd class="lynn_team_list_dd row">
						<img src="{$order['avatar']}" alt="{$order['nickname']}" onerror="this.src='../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/avatar.png'">
						<span class="fl">{if $order['nickname']}{$order['nickname']}{else}匿名{/if}</span>
						<span class="fr">{php echo date('Y-m-d H:i:s', $order['paytime'])} 参团</span>
					</dd>
					{/if}
					{/loop}
				</dl>
			</div>
			<div class="block block-basic tab-basic" id="basic">
				{if $groupsset['description']}
					{php echo htmlspecialchars_decode($groupsset['groups_description'])}
				{else if $goods['content']}
					{php echo htmlspecialchars_decode($goods['content'])}
				{else}
				<div style="font-size:0.7rem;padding:0.2rem">暂无商品详情</div>
				{/if}
			</div>
		</div>
		<div class="step">
			<div class="step_hd">
				<i class="left"></i>拼团玩法<a class="step_more" href="{php echo mobileUrl('groups/team/rules')}">查看详情></a>
			</div>
			<div id="footItem" class="step_list">
				<div class="step_item ">
					<div class="step_num">1</div>
					<div class="step_detail">
						<p class="step_tit">选择
							<br>心仪商品</p>
					</div>
				</div>
				<div class="step_item ">
					<div class="step_num">2</div>
					<div class="step_detail">
						<p class="step_tit">支付开团
							<br>或参团</p>
					</div>
				</div>
				<div class="step_item {if $n==0}{else}step_item_on{/if}" id="step_3">
					<div class="step_num">3</div>
					<div class="step_detail">
						<p class="step_tit" >邀请好友
							<br>参团支付</p>
					</div>
				</div>
				<div class="step_item {if $n==0}step_item_on{else}{/if}" id="step_4">
					<div class="step_num">4</div>
					<div class="step_detail">
						<p class="step_tit">达到人数
							<br>团购成功</p>
					</div>
				</div>
			</div>
		</div>
		<div style="height:2.5rem;"></div>
	</div>
	<div class="fui-navbar lynn_footer">
		{if $n==0}
		<a class="other" href="javascript:void(0);">
			<p class="">团购已成功</p>
		</a>
		{else}
			{if $lasttime2 > 0}
				{if !empty($myorder)}
					{if $n==0}
					<a class="other" href="javascript:void(0);">
						<p class="">团购已成功</p>
					</a>
					{else}
					<a class="other" href="javascript:void(0);" id="invitation">
						<p class="">快邀请好友参团吧</p>
					</a>
					{/if}
				{else}
				<a class="other" href="{php echo mobileUrl('groups/orders/confirm',array('id' => $goods['id'],'teamid' => $teamid,'type'=>'groups'));}">
					<p class="">我要参团</p>
				</a>
				{/if}
			{else}
			<a class="other" href="javascript:void(0);">
				<p class="">本次团已过期</p>
			</a>
			{/if}
		{/if}
		<a class="home" href="{php echo mobileUrl('groups')}">
			<p class="fa icon icon-home"></p>
			首页
		</a>
	</div>
</div>

<div id="cover"></div>
<div id="guide"><img src="../addons/ewei_shopv2/plugin/groups/template/mobile/default/images/guide1.png"></div>

<script type="text/javascript">
	require(['core'],function(modal){
		$('.fui-timer').timer({
			onEnd: function(){
				$(".fui-navbar .btn").removeClass("btn-danger").addClass("btn-disabled").removeAttr("id").text("活动已结束");
			}
		});
	});
	$(function(){
		$("#invitation").on("click",function(){
			if($("#cover").css("display")=='none'){
				$("#cover").show();
				$("#guide").show();
			}
		})
		$("#cover").on("click",function(){
			$("#cover").hide();
			$("#guide").hide();
		})
		$("#detailTab a").unbind('click').click(function () {
			var tab = $(this).data('tab');
			$(this).addClass('active').siblings().removeClass('active');
			$("#"+tab).show().siblings().hide();
		});
		/*$(".lynn_team_list_dd:first").show();
		$(".lynn_team_list_dd:last").show().css("border","none");
		$(".lynn_team_list_top").on("click",function(){
			var $lynn_team_list_dd = $(".lynn_team_list_dd:not(:first,:last)");
			if($lynn_team_list_dd.css("display")=="block"){
				$lynn_team_list_dd.hide(200);
				$(".lynn_icon").html("&#xe764;");
			}else{
				$lynn_team_list_dd.show(200);
				$(".lynn_icon").html("&#xe765;");
			}
		})*/
	})
</script>
{template '_footer'}